INC=-g -I inc -I/usr/include/trilinos -I /usr/include/eigen3 -fopenmp

LIB1=-L /usr/lib64/trilinos -lstdc++ -lm -fopenmp

LIB2=-lifpack2-adapters -lifpack2 -lbelosxpetra -lbelostpetra -lbelos -lzoltan2 -lzoltan -lz -lamd -lamesos2 -ltacho -ltrilinosss -lumfpack -lamd -lshylu_nodefastilu -lgaleri-xpetra -lxpetra-sup -lxpetra -lthyratpetra -ltpetraext -ltpetrainout -ltpetra -ltpetraclassic -lkokkostsqr -lteuchosremainder -lteuchoskokkoscomm -lteuchoskokkoscompat -lkokkoskernels -lmetis -lGKlib -lthyracore -lrtop -lteuchosnumerics -lteuchoscomm -lteuchosparameterlist -lteuchosparser -lteuchoscore -lbfd -lkokkossimd -lkokkosalgorithms -lkokkoscontainers -lkokkoscore -llapack -lblas
MAKEFLAGS += -j2
#all:main.exe main_test.exe
#	echo "Compiling!"

main.exe: belos_solve.cpp inc/build_solver.hpp inc/build_precond.hpp#build_solver.o
	ccache mpicxx belos_solve.cpp -o main.exe $(INC) $(LIB1) $(LIB2)
#main_test.exe: belos_solve_test.cpp inc/build_solver.hpp inc/build_precond.hpp#build_solver.o
#	ccache mpicxx belos_solve_test.cpp -o main_test.exe $(INC) $(LIB1) $(LIB2)
	#g++ belos_solve.cpp -o run.exe $(LIB1) $(LIB2)
#build_solver.o: build_solver.cpp
#	ccache mpicxx -c build_solver.cpp $(INC)

#belos_solve.o: belos_solve.cpp inc/build_solver.hpp
#	mpicxx -c belos_solve.cpp $(INC)
run:
	cp run.log "log/run.log.$(shell date +%m%d-%H%M).log"
	echo -e "\033[31m=====================   ########## @@@@@@@@@@@@@@@@@@@@ ###########  =====================\033[0m"
	./exec.sh false| tee run.log

run1:
	cp run1.log "log/run1.log.$(shell date +%m%d-%H%M).log"
	echo -e "\033[31m=====================   ########## @@@@@@@@@@@@@@@@@@@@ ###########  =====================\033[0m"
	#sed -i '/test_new/s/value="\w*"/value="true"/' poly_test.xml
	./exec.sh true| tee run1.log
	#2>error.log | tee run.log 
	#. pre.sh
	#cat chebyshev.log ilut.log none.log > run.log
	#grep "\(total program time\|===\)" run.log | sed  -r "s/\x1B\[[0-9;]*[JKmsu]//g" > profile.txt
	#./main.exe --xml_file=sav/poly.xml
	#./run.exe --xml_file=ilu.xml 
